    /* global getCookie */
    /* global hex_md5 */

    function passwordIn () {
        var oldPassword = $("#oldPassword").val();
        var password = $("#password").val();  

        if (password == ''){
            $.toast("密码不能为空", "cancel");
            return;
        }
        var params = {};
        params.token = getCookie('token');
        params.password = hex_md5(password).toUpperCase();

        if (oldPassword) {
            params.oldPassword = hex_md5(oldPassword).toUpperCase();
        }

        $.ajax({
            type:'POST',
            url:"/antique/api/sysUser/set_paypass",
            data: params,
            dataType:"json",
            success:function(res){
                if (res.code == 0){
                    $.toast("成功！");
                    $("#oldPassword").val("");
                    $("#password").val(""); 
                 } else if (res.code == 101) {
                    $.toast("请输入原始密码", "cancel");
                 } else {
                    $.toast(res.message, "cancel");
                }
                
            }
        });
       
        
    }
    

